package com.intexh.speedandroid.web.inteface;

import android.os.Handler;
import android.os.Message;
import android.webkit.JavascriptInterface;

import com.intexh.speedandroid.utils.LogUtil;
import com.intexh.speedandroid.sharesdk.bean.ShareBean;
import com.intexh.speedandroid.web.ui.WebViewActivity;

public class JavaScriptInterface {

    private Handler handler;

    public JavaScriptInterface(Handler handler) {
        this.handler = handler;
    }



    @JavascriptInterface
    public void back() {
        Message message = new Message();
        message.what = WebViewActivity.BACK;
        handler.sendMessage(message);
    }

    @JavascriptInterface
    public void pay_order(String payInfo){ //这里
        Message message = new Message();
        message.what = WebViewActivity.PAY;
        message.obj = payInfo;
        handler.sendMessage(message);
    }

    @JavascriptInterface
    public void share(String title,String text,String url,String icon){ //这里
        Message message = new Message();
        message.what = WebViewActivity.SHARE;
        ShareBean shareBean = new ShareBean(title,text,icon,url);
        message.obj = shareBean;
        handler.sendMessage(message);
    }

    @JavascriptInterface
    public void login(){
        LogUtil.e("frank","H5吊起登录");
        Message message = new Message();
        message.what = WebViewActivity.LOGIN;
        handler.sendMessage(message);
    }





}